﻿<section class="content search">
    <div class="search-form">
        <div class="wrap">
            <form id="tagSearch" class="tag-search" ng-submit="submit()">
                @if (User.Identity.IsAuthenticated)
                {
                    <ul class="control" ng-show="isAuthentificate">
                        <li ng-repeat="searchType in $searchType.searchTypes" ng-class="{active : $searchType.selected.type == searchType.type}"
                            ng-click="changeSearchType(searchType)">
                            <i class="icon" ng-class="{ 'icon-star': searchType.type == 'own', 'icon-menu': searchType.type == 'general' }"></i>{{searchType.title}}</li>
                    </ul>
                }
                <div class="form">
                    <i class="icon icon-tag-large"></i>
                    <ul id="tags"></ul>
                    <i class="icon icon-search" ng-click="submit()"></i>
                </div>
            </form>
        </div>
    </div>
    <div class="search-result wrap" infinite-scroll='loadMore()' infinite-scroll-disabled='IsLoading' infinite-scroll-distance='1'>
        <div class="col left">
            <div ng-repeat="result in searchResultsEven" class="search-result-item">

                <div class="add" ng-if="isAuthentificate">
                    <i class="icon icon-add"></i>
                </div>

                <img class="screen" ng-if="result.Image.length > 0" src="{{result.Image}}" />
                <div class="text">
                    <div class="title">
                        <a href="{{result.Uri}}">{{result.Title.length > 0 ? result.Title : result.Uri }}</a>
                    </div>
                    <div class="link" style="background-image: url({{result.favicon}})">{{result.HostUri}}</div>
                    <div class="desc">{{result.Description}}</div>
                    <ul class="tags-list">
                        <li class="tag tag-small tag-item" ng-repeat="tag in result.Tags">{{tag.tag}}</li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="col right">
            <div ng-repeat="result in searchResultsOdd" class="search-result-item">

                <div class="add" ng-if="isAuthentificate">
                    <i class="icon icon-add"></i>
                </div>

                <img class="screen" ng-if="result.Image.length > 0" src="{{result.Image}}" />
                <div class="text">
                    <div class="title">
                        <a href="{{result.Uri}}">{{result.Title.length > 0 ? result.Title : result.Uri }}</a>
                    </div>
                    <div class="link" style="background-image: url({{result.favicon}})">{{result.HostUri}}</div>
                    <div class="desc">{{result.Description}}</div>
                    <ul class="tags-list">
                        <li class="tag tag-small tag-item" ng-repeat="tag in result.Tags">{{tag.tag}}</li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <div style="margin-left: 50%;" ng-show="IsLoading">
        <i class="loader"></i>Загрузка... </span>
    </div>
</section>
